<template>
  <div class="map-echart">
    <div ref="echarts" class="charts"></div>
  </div>
</template>

<script>
import * as echarts from "echarts";
export default {
  data() {
    return {
      type: "bar",
    };
  },
  mounted() {
    this.initCharts();
  },
  methods: {
    initCharts() {
      let myChart = echarts.init(this.$refs.echarts);
      const option = {
        xAxis: {
          type: "category",
          data: [
            "2022-01-01",
            "2022-01-02",
            "2022-01-03",
            "2022-01-04",
            "2022-01-05",
          ],
        },
        yAxis: {
          type: "value",
          data: [1, 2, 3, 4],
        },
        series: [
          {
            name: "1",
            type: "line",
            data: [5, 20, 30],
          },
        ],
      };

      myChart.setOption(option);

      window.onresize = function () {
        myChart.resize();
      };
    },
  },
};
</script>

<style lang="scss" scoped>
.charts {
  width: 80px;
  height: 50px;
  background-color: #00000033;
   position: absolute;
}
</style>